// 在主进程中.
const {
  ipcRenderer
} = require('electron')

export default {
  request: (requestParam, callback, sync = true) => {
    ipcRenderer.once(`${requestParam.method}-reply`, (event, arg) => {
      callback(arg)
    })
    if (sync) {
      ipcRenderer.send('client-request', requestParam)
    } else {
      ipcRenderer.sendSync('client-request', requestParam)
    }
  }
}

